<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"/><html><head><meta name="description" content="A sample page"/><title>Sample</title><link rel="stylesheet" href="stylesheet.css"/><link rel="shortcut icon" href="icon.ico"/></head><!-- This is a comment. It will not appear on the browser. --><body><h1>Sample</h1><p>
This is a paragraph. Here is a
<ul><li>list</li><li>with some item</li></ul>
This is in <b>boldface</b> this is in <i>italics</i> as is <em>this</em>.
</p><p>
This is another paragraph. <br/><br/>
With an empty new line.
</p><h2>Sub heading</h2><p>
This is a <a href="http://jmvidal.cse.sc.edu">hyperlink</a>.
This adds an image: <img src="image.png" title="a rose"/></p></body></html>
Sample
Sample
This is a paragraph. Here is a
list
with some item
This is in boldface this is in italics as is this.
An XHTML document can be written to be understood by older
(HTML) browsers.
XHTML documents can use applications that rely on the HTML
DOM or or the XML
DOM.
Note:
Because of the lack of a formal HTML specification, the early
browsers extended and modified HTML as they pleased. They also
modified their parsers so as to display markup that was not
valid but common nonetheless in an effort to please the
users. That is, users would complain that the browser did not
display a certain page even thought it was the page itself
that was incorrectly written. As such, the HTML language
evolved to be very complex for machines to parse.
XML, on the other hand, had been designed to be easy for
machines to parse. The retro-fitting of HTML into an XML
framework gave rise to XHTML.
2.1 Why XHTML?
Because it is eXtensible. New features can be
added with the use of namespaces.
XHTML is designed so it can be used by different
user agents (mobile phones, text-to-speech, autonomous
agents).
2.2 XHTML Conformance
Must obey the XHTML DTDs.
Root element must be html.
The html must contain an xmlns
pointing to the the XHTML namespace. <html
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en">
A DOCTYPE must appear before the
html and point to the appropriate XHTML DTD.
Cannot override any parameter entities in the DTD.
Example:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>Virtual Library</title></head><body><p>Moved to <a href="http://example.org/">example.org</a>.</p></body></html>
2.3 XHTML and other Namespaces
Although it is not strictly conforming, XHTML can include
other namespaces.
For example, in order to get something like
you would use
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>A Math Example</title></head><body><math xmlns="http://www.w3.org/1998/Math/MathML" mode="display"><mo>∫</mo><msup><mi>e</mi><mi>x</mi></msup><mi>dx</mi><mo>=</mo><msup><mi>e</mi><mi>x</mi></msup></math></body></html>
2.4 Differences with HTML
Must be well-formed <p>This is <em>bad</p></em>
Element and attribute names in lower case.
Use end tags.
<p>This</p>
or
This<p/>
but not
This<p>.
Attribute values must always be quoted, like <td
rowspan="1">this</td>
Only attribute-value pairs are allowed. <dl
compact> is not allowed, use <dl
compact="compact"> instead.
Note:
You should always use XHTML, especially when the content is
generated automatically, for example, by a servlet. XHTML
imposes restrictions for the writer of the markup which then
serve to significantly lighten the load of the reader
(browser). This means that web pages can be rendered faster
and processed by automated agents. The hope is that if we have
more strictly formatted content then automated agents and
other aggregators will be easier to develop which will begin
the evolution towards the Semantic Web.